<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <button @click="fn">点我打印</button>
    </div>

    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data () {
          return {
            msg: '你好',
            age: 16
          }
        },
        methods: {
          fn () {
            // vue里的this，就是当前Vue实例
            // vue会在创建的某个阶段把data和methods里的内容挂载到最外层
            console.log(this.msg)
            console.log(this.age)
            // 访问另外一个函数？
            this.fn2()
          },

          fn2 () {
            console.log('fn2调用了')
          }
        }
      })
    </script>
  </body>
</html>
